/**
 * 使用方法
 * <footer current="2"></footer>
 * */
const app = getApp();
Component({
    properties: {
        /**
         * 是否显示
         * */
        showLeft: {type: Boolean},
        animationData: {
            type: Object,
            value: false
        },
        phone: {type: String}
    },
    data: {
        navList: [
            {name: '三轮车', img: '/assets/images/index2.png', path: 'Tricycle'},
            {name: '套餐', img: '/assets/images/index3.png', path: 'SetMeal'},
            {name: '我的邀请', img: '/assets/images/index1.png', path: 'Recommend'}
        ],
    },
    methods: {
        closed: function () {
            var that = this;
            var animation = wx.createAnimation({
                duration: 400,
                timingFunction: 'linear'
            })
            that.animation = animation
            animation.translateX(-690).step()
            that.setData({
                animationData: animation.export(),
            })
            setTimeout(function () {
                animation.translateX(0).step()
                that.setData({
                    animationData: animation.export(),
                    showLeft: false
                })
            }, 300)
        },
        toPages: function (even) {
            let $dataset = even.currentTarget.dataset;
            if ($dataset.page == '') {
                /*   wx.showToast({
                 title: '即将开放',
                 icon: 'none',
                 duration: 2000
                 });*/
                return
            }
            app.navigateTo(app.page[$dataset.page]);
        },
        help: function() {
            var object = {
                url: app.api.url.assistant.service,
                data: {type: 1},
                success: function(res) {
                    if(res.status == 1) {
                        app.navigateTo(app.page.wapUrl, 'url='+res.data.url);
                    }
                }
            }
            app.request(object);
        },
        officialTel: function() {
            var object = {
                url: app.api.url.assistant.config,
                data: {type: 1},
                success: function(res) {
                    if(res.status == 1) {
                        app.showModal('官方电话', res.data.content, false);
                    }
                }
            }
            app.request(object);
        }
    },
});
